<template>
	<view class="order-list">
		<view class="order-item" v-for="(item, index) in productlist" :key="index">
			<view class="order-header">
				<text>订单编号：{{ item.orderNum }}</text>
				<text class="product-status">{{ item.productStatus }}</text>
			</view>
			<view class="order-content">
				<image class="product-image" :src="`/static/${item.img}`" mode="aspectFit"></image>
				<view class="product-details">
					<view>
						<text class="product-name">【{{ item.name }}】</text>
						<text class="product-information">{{ item.productInformation }}</text>
					</view>
					<text class="product-logistics">物流信息: {{ item.logistics || '暂无' }}</text>
					<text class="product-price">实付:{{ item.price | priceFormatter }}</text>
				</view>
			</view>
			<view class="order-footer">
				<text class="product-time">下单时间: {{ item.time }}</text>
				<view class="but">
					<button>查看详情</button>
					
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			productlist: {
				type: Array,
				default: () => [] // 默认值是一个空数组
			}
		},
		filters: {
			priceFormatter(value) {
				return `￥${value.toFixed(2)}`;
			}
		}
	}
</script>

<style>
	.order-list {
		width: 100%;
	}
	.order-item {
		margin-bottom: 10px;
		background-color: #ffffff;
		padding: 30rpx;
		border-radius: 30rpx;
		border: 1px #ccc solid;
	}
	.order-header {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}

	.order-content {
		display: flex;
		border-bottom: 1px #ccc solid;
		padding-bottom: 20rpx;
	}

	.product-image {
		width: 110rpx;
		height: 110rpx;
		margin-right: 10px;
	}

	.product-details {
		flex: 1;
		display: flex;
		flex-direction: column;
	}
	.product-name,.product-information, {
		font-size: 28rpx;
		font-weight: bold;
		margin-bottom: 10rpx;
	}
	
	.product-logistics,
	.product-price {
		font-size: 24rpx;
		margin-top: 20rpx;
	}

	.product-price {
		color: #ff0000;
	}

	.order-footer {
		display: flex;
		margin-top: 20rpx;
		flex-direction: row;
		justify-content: space-between;
	}

	.product-time {
		font-size: 24rpx;
		color: #666;
	}
	.but button{
		width: 175rpx;
		font-size: 24rpx;
		background-color: #fff;
		border-radius: 50rpx; /* 设置上边和右边的圆角 */
		border: 1px #ccc solid;
		display: inline-block;
		margin-right: 20rpx;
	}
</style>
